package com.muyi.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyi.pojo.entity.TagPaper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @author VRMMO
 * @description 针对表【tag_paper】的数据库操作Mapper
 * @createDate 2025-06-11 15:04:41
 * @Entity com.muyi.pojo.entity.TagPaper
 */
@Mapper
public interface TagPaperMapper extends BaseMapper<TagPaper> {
    /**
     * 查询全部标签-文章
     * @return
     */
    @Select("select * from tag_paper")
    List<TagPaper> list();

    /**
     * 根据ID删除标签-文章
     * @param tag_paper_id
     */
    @Delete("delete from tag_paper where tag_paper_id = #{tag_paper_id}")
    void deleteById(Integer tag_paper_id);

    /**
     * 新增标签-文章
     *
     * @param tag_paper
     * @return
     */
    int insertAll(TagPaper tag_paper);


    /**
     * 更新标签-文章
     * @param tag_paper
     */
    @Update("update tag_paper set tag_id=#{tag_id}, paper_id=#{paper_id} where tag_paper_id=#{tag_paper_id}")
    void update(TagPaper tag_paper);

    @Select("select * from tag_paper where tag_paper_id = #{tag_paper_id}")
    TagPaper getByTagPaperId(Integer tag_paper_id);
}




